﻿using Abp.Configuration.Startup;
using Abp.Modules;
using Abp.WebApi;
using GN.Pay.Application;
using GN.Pay.Core;
using GN.Pay.Core.Runtime;
using GN.Pay.Core.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay
{
    /// <summary>
    /// 网关端 WebApi 模块
    /// </summary>
    [DependsOn(typeof(AbpWebApiModule), typeof(ApplicationModule))]
    public class GatewayWebApiModule : AbpModule
    {
        public override void Initialize()
        {
            Consts.Start.ProcessType = ProcessType.Gateway;
            Consts.Start.StartTime = DateTime.Now;

            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
            var builder = Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder;

            //消息
            // builder.For<IMessageAppService>("local/message").Build();

            //用户
            //  builder.For<IUserAppService>("local/authorization/user").Build();

            var queuePool = this.IocManager.Resolve<ITaskQueueWorkPool>();
            queuePool.Start();

        }
    }
}
